package com.zhangjianling.premp.dao.sys;

import com.zhangjianling.premp.entity.sys.SysMenu;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;



public interface SysMenuDao extends PagingAndSortingRepository<SysMenu, String>,
JpaSpecificationExecutor<SysMenu>{

	SysMenu findByName(SysMenu menu);
	
	
	@Query("select t from SysMenu t where t.parentMenu IS NULL")
	List<SysMenu> findTopList();
	
	@Query("select t from SysMenu t order by t.menuId desc")
	List<SysMenu> findAll();
	
	@Query(value="select * from sys_menu t where t.pid=?1 and t.status=0 order by t.menuId asc",nativeQuery=true)
	List<SysMenu> findChilds(String pid);

}